<?php
session_start();
$loginId=$_SESSION['loginid'];
$name=$_SESSION['name'];
$userType=$_SESSION['user_type'];

include_once('connection/connection.php');
 include('config.php');
$frm=$_REQUEST['var'];
$qr="select * from tbl_dtls_q2_main where id='$frm'";
$res=mysql_query($qr);
$rowMain=mysql_fetch_assoc($res);
//print_r($rowMain);

?>
 <html>
 <head></head>
 <body>
 <script type="text/javascript" src="js/ajaxFunction_q2_new.js" ></script>
<script language="javascript">
function enable_sanc1(status)
{
  
	if(document.getElementById('scheme_sactioned')[document.getElementById('scheme_sactioned').selectedIndex].value=='Other')
	{
  		status=!status;
  		document.getElementById('scheme_sactioned_other').disabled=status;
  		document.getElementById('scheme_sactioned_other').focus();
	}
	else
	{
		document.getElementById('scheme_sactioned_other').disabled=true;	
	}

}
</script>
<div class="section_format" >
  <form action="scheme_section1_q2.php" method="post" name="sec1" id="sec1" onSubmit="return sec1_val();">
  <table border="1">
    
    <tr>
      <td width="400">&nbsp;<b>Type of the Scheme (As of Now)</b></td>
      <td width="400">&nbsp;<?php echo "$rowMain[type_scheme]";?>
	  <input type="hidden" name="frmId" id="frmId" value="<?php echo $frm;?>" />
	  <input type="hidden" name="loginId" id="loginId" value="<?php echo $loginId;?>" />
	  <input type="hidden" name="name" id="name" value="<?php echo $name;?>" />
	  <input type="hidden" name="userType" id="userType" value="<?php echo $userType;?>" />
	  </td>
      </tr>
    <tr>
      <td>&nbsp;<b>Name of the Scheme</b></td>
      <td>&nbsp;<input type="text" name="scheme_name" id="scheme_name" value="<?php echo "$rowMain[scheme_name]";?>" /></td>
      </tr>
    <tr>
      <td>&nbsp;<b>Year of Commissioning</b></td>
      <td>&nbsp;<select size="1" name="YOC" id="YOC" class="txt">
	  					<option selected value="0">Select:</option>
						<option selected value="Not Provided">Not Provided</option>
						<?php 
						foreach($year_comm as $key=>$val)
						{
							if($rowMain['year_comm']==$val)
							{
		   						echo "<option value=$val selected>$val</option>";
							}
							else
							{
								echo "<option value=$val>$val</option>";
							}
						}
						?>
						</select></td>
      </tr>
    <tr>
      <td>&nbsp;<b>Capital Cost (in <img src="images/26rup1.jpg" width="10"> Lakh)</b></td>
      <td>&nbsp;<input type="text" name="CC" id="CC" value="<?php echo "$rowMain[capital_cost]";?>" /></td>
      </tr>
	  <tr>
      <td>&nbsp;<b>Scheme Sanctioned Under</b></td>
      <td>&nbsp;<select size="1" name="scheme_sactioned" id="scheme_sactioned" class="txt" onChange="enable_sanc1(true)">
                      <option selected value="0">Select Scheme</option>
                      <?php 
						foreach($scheme as $key=>$val)
						{
							$val1=$rowMain['scheme_sanction'];
						if($val1=='State-Plan-(Old-MNP)' || $val1=='NRDWP-(Old-ARDWP)' || $val1=='Swajal-Dhara-&-Sector-Reform')
						{
							if($val1==$val)
							{
		   						echo "<option value=$val selected>$val</option>";
							}
							else
							{
								echo "<option value=$val>$val</option>";
							}
						}
						if($val1!='State-Plan-(Old-MNP)' && $val1!='NRDWP-(Old-ARDWP)' && $val1!='Swajal-Dhara-&-Sector-Reform')
						{
							if($val1!=$val)
							{
		   						echo "<option value=$val selected>$val</option>";
							}
							else
							{
								echo "<option value=$val>$val</option>";
							}
						}
						}
						?>
                    </select></td>
      </tr>
	    <tr>
				  <td width="270" height="26">&nbsp;</td>
					<td width="477">
						 <font style="font-size: 8pt" face="Verdana" color="#000000"> If Other then specify&nbsp;</font><input type="text" name="scheme_sactioned_other" id="scheme_sactioned_other" value="<?php if($rowMain['scheme_sanction']!='State-Plan-(Old-MNP)' && $rowMain['scheme_sanction']!='NRDWP-(Old-ARDWP)' && $rowMain['scheme_sanction']!='Swajal-Dhara-&-Sector-Reform'){ echo $rowMain['scheme_sanction'];$dis=""; } else{ echo '';$dis="disabled";} ?>" style="font-size: 8pt; font-family: Verdana; border-style: solid; border-width: 1px" <?php echo $dis;?>></td>
				</tr>
	  <tr>
	    <td colspan="2" align="center"><input type="submit" value="EDIT" name="submit" style="font-size: 8pt; font-family: Verdana; border-style: solid; border-width: 1px; font-weight:bold; background:#666666; color:#FFFFFF; width:140px; height:30px" onClick="view_validate()"></td>
  </tr>
  </table>
  </form>
  </div>
</body>
</html>